﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ABC_SA_BL;

namespace ABC_SA
{
    public partial class ConClienteForm : Form
    {
        public ConClienteForm()
        {
            InitializeComponent();
            textuser.ReadOnly = true;
        }
        public void consultar()
        {
            Cliente_BL cliente = new Cliente_BL();
            dataClient.DataSource = cliente.consultarClientes();
            //dataClient.Columns.Remove("Contrasena");
            //dataClient.Columns.Remove("Rol");
            dataClient.Columns["IdCliente"].DisplayIndex = 0;
            dataClient.Columns["UserName"].DisplayIndex = 1;
            dataClient.Columns["Nombre"].DisplayIndex = 2;
            dataClient.Columns["ApellidoPat"].DisplayIndex = 3;
            dataClient.Columns["ApellidoMat"].DisplayIndex = 4;
            dataClient.Columns["Identificacion"].DisplayIndex = 5;
            dataClient.Columns["Nacionalidad"].DisplayIndex = 6;
            dataClient.Columns["Email"].DisplayIndex = 7;
            dataClient.Columns["Rol"].Visible = false;
            dataClient.Columns["Contrasena"].Visible = false;
        }
        private void btncon_Click(object sender, EventArgs e)
        {
            consultar();
        }
        
        private void dataClient_Click_1(object sender, EventArgs e)
        {
            try
            {
                textuser.Text = Convert.ToString(dataClient.CurrentRow.Cells[7].Value);
            }
            catch { 
            
            }
            
        }

        private void btnatras_Click(object sender, EventArgs e)
        {
            AdminForm admin = new AdminForm();
            this.Dispose();
            admin.Show();
        }
    }
}
